<?php
/**
 * used in bloglist
 * class in bloglist.class
 */
/**
 * display comments
 */

if ($oneBlog==1){
echo '<div id="blogcommentsdisplay">';
$comments = $page->getBlogComment($blogId);
if (!empty($comments)){
	foreach ($comments as $comment){
		$usernumber = $comment['usernumber'];
		$commentblogowner = $page->getBlogownerByBlogId($blogId);
		$userInfo = $page->getUserInfo($usernumber);
		if (!$userInfo['image']){
			$headimg = $Helper->loadXmlFile("config/xml/system.xml")->userinfo->headimg;
			$userInfo['image'] = $headimg;
		}
		if ($comment['replyto']){
			$replytouser = $page->getUserInfo($comment['replyto']);
			$comment['replyto'] = $replytouser[0];
		}
?>
	<div class="blogcommentsdisplayone">
		<div class="blogcommentsdisplayleft">
			<img src="<?php echo $userInfo['image']?>" alt="userhead" width="80px" height="100px" /><br />
			<?php echo $userInfo['user_name']?>
		</div>
		<div class="blogcommentsdisplayright">
			<?php if($comment['replyto'])echo "回复".$comment['replyto']; ?>
			<?php echo $comment['postdate'];?><br />
			<?php echo $comment['content'];?>
			<?php if ($comment['usernumber']==$page->userNumber||$page->userNumber==$commentblogowner){echo "<br /><input type='button'  value='删除' id='blogdeletebutton_$comment[id]' onclick=deleteblogcomment($comment[id]) />";}?>
			<?php if ($page->userNumber){echo "<br /><input type='button'  value='回复' id='blogreplybutton_$comment[id]' onclick=replytosetform('$comment[usernumber]','$comment[id]','$comment[username]') />";}?>
		</div>
	</div>
<?php
	}
}
echo "</div>";
?>
<!-- set blog comment -->
<div id="blogcomment">
发表评论：<br />
	<div id="blogcommentmainbody">
		<form>
		<h3 id="replytohead"></h3>
		姓名：<?php 
		if($page->userName){
			echo $page->userName;
			echo "<input name='commentusername' id='commentusername' style='display:none' value=$page->userName />";
		}else {
			echo "<input name='commentusername' id='commentusername' />";
		}
		?>
		<br />
		<div id="commentbody">
			内容：<br /><textarea name="commentparentid" id="commentcontent" ></textarea>
		</div>
		<input type="text" name="commentblogid" id="commentblogid" value="<?php echo $blogId?>" style="display:none;" />
		<input type="text" name="commentusernumber" id="commentusernumber" value="<?php echo $page->userNumber?>" style="display:none" />
		<input type="text" name="commentparentid" id="commentparentid" style="display:none;" />
		<input type="text" name="commentreplyto" id="commentreplyto" style="display:none;" />
		<div class="conmmentsubmit">
			<input type="button" name="commentsubmit" id="commentsubmit" value="评论" /> <input type="reset" name="commentreset" id="commentreset" value="重置" />
		</div>
		</form>
	</div>
</div>
<?php
}
?>